package scrn;


import java.awt.EventQueue;
import java.awt.Toolkit;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JTextPane;
import javax.swing.text.BadLocationException;
import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
import javax.swing.JLabel;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;


public class WinMain {

private JFrame frame;


/**
 * Launch the application.
 */
public static void main(String[] args) {

	EventQueue.invokeLater(new Runnable() {

		public void run() {

			try {
				WinMain window = new WinMain();
				window.frame.setVisible(true);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	});
}


/**
 * Create the application.
 */
public WinMain() {

	initialize();
}


/**
 * Initialize the contents of the frame.
 */
private void initialize() {

	frame = new JFrame();
	frame.setIconImage(Toolkit.getDefaultToolkit().getImage("W:\\molchat.net\\pc\\molchat_pc\\trunk\\src\\res\\icon.png"));
	frame.setTitle("МолЧАТ");
	frame.setBounds(100, 100, 595, 777);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

	JTextPane textPane = new JTextPane();
	
	JLabel lblNewLabel = new JLabel("New label");
	
	JScrollPane scrollPane = new JScrollPane();
	GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
	groupLayout.setHorizontalGroup(
		groupLayout.createParallelGroup(Alignment.LEADING)
			.addGroup(groupLayout.createSequentialGroup()
				.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
					.addGroup(groupLayout.createSequentialGroup()
						.addContainerGap()
						.addComponent(textPane, GroupLayout.PREFERRED_SIZE, 355, GroupLayout.PREFERRED_SIZE)
						.addPreferredGap(ComponentPlacement.RELATED)
						.addComponent(lblNewLabel))
					.addGroup(groupLayout.createSequentialGroup()
						.addGap(174)
						.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 350, GroupLayout.PREFERRED_SIZE)))
				.addContainerGap(63, Short.MAX_VALUE))
	);
	groupLayout.setVerticalGroup(
		groupLayout.createParallelGroup(Alignment.LEADING)
			.addGroup(groupLayout.createSequentialGroup()
				.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
					.addGroup(groupLayout.createSequentialGroup()
						.addContainerGap()
						.addComponent(textPane, GroupLayout.PREFERRED_SIZE, 263, GroupLayout.PREFERRED_SIZE))
					.addGroup(groupLayout.createSequentialGroup()
						.addGap(69)
						.addComponent(lblNewLabel)))
				.addGap(94)
				.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 353, GroupLayout.PREFERRED_SIZE)
				.addContainerGap(29, Short.MAX_VALUE))
	);
	
	JTextPane textPane_1 = new JTextPane();
	scrollPane.setColumnHeaderView(textPane_1);
	
	JTextPane textPane_2 = new JTextPane();
	scrollPane.setRowHeaderView(textPane_2);
	
	JTextPane textPane_3 = new JTextPane();
	scrollPane.setViewportView(textPane_3);
	frame.getContentPane().setLayout(groupLayout);


	try {
		StyledDocument doc = (StyledDocument) textPane.getDocument();

		Style style = doc.addStyle("StyleName", null);
		ImageIcon image = new ImageIcon("/res/icon.png");
		StyleConstants.setIcon(style, image);

		doc.insertString(doc.getLength(), "testString ", null);
		doc.insertString(doc.getLength(), "ignored text ", style);
		doc.insertString(doc.getLength(), "testString2 ", null);
	} catch (BadLocationException e) {
		e.printStackTrace();
	}
}
}
